package com.yoshino.iterator;

import java.util.Iterator;

/**
 * @author yoshino
 **/
public class ComputerCollegeIterate implements Iterator {

    // 这里需要 Department 是以怎样的方式存放
    Department[] departments;
    int position = 0; // 遍历的位置

    public ComputerCollegeIterate(Department[] departments) {
        this.departments = departments;
    }

    @Override
    public boolean hasNext() {
        if (position >= departments.length || departments[position] == null) {
            return false;
        }
        return true;
    }

    @Override
    public Object next() {
        return departments[position++];
    }

    @Override
    public void remove() {

    }
}
